package com.haiyang.auth.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.haiyang.auth.mapper.SysPermissionMapper;
import com.haiyang.auth.mapper.SysRoleMapper;
import com.haiyang.auth.model.PermissionEntity;
import com.haiyang.auth.model.SysRoleEntity;
import com.haiyang.auth.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;


@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRoleEntity> implements SysRoleService {

    @Autowired
    SysPermissionMapper sysPermissionMapper;

    @Override
    public List<PermissionEntity> findByRoleCode(Set<String> roleIds) {
        QueryWrapper<PermissionEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.in("role_id",roleIds);
        List<PermissionEntity> permissionEntities = sysPermissionMapper.selectList(queryWrapper);
        return permissionEntities;
    }
}
